package com.wayne.sqlInjector;

import com.baomidou.mybatisplus.core.injector.AbstractMethod;
import com.baomidou.mybatisplus.core.metadata.TableInfo;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.mapping.SqlSource;

public class FindAll extends AbstractMethod {

  public FindAll() {
    super("findAll");
  }

  @Override
  public MappedStatement injectMappedStatement(Class<?> mapperClass, Class<?> modelClass, TableInfo tableInfo) {
    String sqlMethod = "findAll";
    String sql = "select * from " + tableInfo.getTableName();
    SqlSource sqlSource = languageDriver.createSqlSource(configuration,
        sql, modelClass);
    return this.addSelectMappedStatementForTable(mapperClass, sqlMethod, sqlSource,tableInfo);
  }
}
